const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}

// 获取屏幕宽度
//const screenWidth = wx.getSystemInfoSync().windowWidth;

const screenWidth = wx.getWindowInfo().screenWidth

//从 rpx 转换为 px
export function rpxToPx(rpx) {
  return (rpx / 750) * screenWidth;
}

//从 px 转换为 rpx
export function pxToRpx(px) {
  return (px / screenWidth) * 750;
}


module.exports = {
  formatTime
}


// export const config = {
  // export const apiBaseUrl= "https://osapi.puxiansheng.cn/"
  // export let token= ""
  // export let phone= ""
  // export let name= ''
  // export let staff_duty= ''
  // export let staff_org= ""
  // export let staff_number= ''
  // export let ROLE= 0
  // export let transfer_permission= []
  // export let findshop_permission= []
  // export let finance_permission= []
  // export let staff_picture= ""
  // export let branch_id= ''
  // export let UserInviteCode= undefined
// };

//module.exports = config;
